package NO12;

import java.util.Stack;

/**
 * 将输入整数以二进制的形式展现出来
 * @author swg
 *
 */
public class NumTo2 {
	private static Stack<Integer> stack = new Stack();
	
	public static void numTo2(int num){
		for(int i=0;i<32;i++){
			int slot = num & 1;
			num >>>= 1;
			stack.push(slot);
		}
	}
	
	public static void main(String[] args) {
		numTo2(2);
		while(!stack.isEmpty()){
			System.out.print(stack.pop()+" ");
		}
	}
}
